<!-- 样式写下边不起作用，未找到原因 -->
<template>
  <div class="lookInfo-print-container">
    <div class="title-name" style="font-size: 16px;margin-bottom: 40px;text-align:center;">立项前各部门尽调表</div>
    <div class="main-content">
      <table border="1px" cellspacing="0px" cellpadding="10px" width="100%">
        <tr>
          <td width="150px">项目名称（代号）</td>
          <td>{{ detailData.info_no }}</td>
          <td width="110px" align="center">签名及时间</td>
          <td align="center" />
        </tr>
        <tr v-for="(item, index) in settingList" :key="index">
          <td width="150px" align="center">
            <div style="min-height:120px;width: 150px;display:flex;justify-content:center;align-items:center">
              <p>{{ item.name }}</p><p v-if="item.tip">（{{ item.tip }}）</p>
            </div>
          </td>
          <td colspan="3">
            <div v-for="(itm,idx) in item.print_list" :key="idx" style="width:100%;line-height: 24px;">{{ itm }}</div>
          </td>
          <!-- <td width="110px" align="center">
            <template v-if="item.creator">
              <div style="margin-bottom: 5px">{{ item.creator.creator_name }}</div>
              <div>{{ parseTime(item.creator.updated_at, "{y}-{m}-{d}") || parseTime(item.created_at, "{y}-{m}-{d}") }}</div>
            </template>
          </td> -->
        </tr>
        <tr>
          <td width="150px" align="center"><p>财务部意见</p></td>
          <td></td>
          <td width="150px" align="center"><p>总经理意见</p></td>
          <td>{{ detailData.resolution_advice }}</td>
        </tr>
        <tr>
          <td width="150px" align="center"><p>备注</p></td>
          <td colspan="3">{{ detailData.remark }}</td>
        </tr>
      </table>
    </div>
  </div>
</template>

<script>
import { lookInfoList } from '@/api/projectInformation'
export default {
  props: {
    detailData: {
      type: Object,
      default: () => {}
    },
    settingList: {
      type: Array,
      default: () => {}
    },
    types: {
      type: Number,
      default: 1
    }
  },
  data() {
    return {
      departmentList: []
    }
  },
  // 生命周期 - 创建完成（访问当前this实例）
  created() {
    if (this.detailData) {
      if (this.types === 1) {
        this.getLookInfoList({ id: this.detailData.id })
      } else if (this.types === 2) {
        this.getLookInfoList({ id: this.detailData.demand_info_id })
      }
    }
  },
  methods: {
    getLookInfoList(params) {
      lookInfoList(params).then(res => {
        if (res.code === 200) {
          this.departmentList = res.data
          console.log(res.data)
        }
      })
    }
  }
}
</script>
<style lang="scss" scoped>
/* @import url(); 引入css类 */
.lookInfo-print-container {
    .title-name{
        font-size: 16px;margin-bottom: 40px;text-align:center;
    }
}
</style>
